package jp.sinya.verify;

import org.junit.Test;

import javax.imageio.ImageIO;
import java.awt.*;
import java.awt.image.BufferedImage;
import java.io.FileOutputStream;
import java.io.IOException;

public class VerificationDemo {

    @Test
    public void test1() {
        BufferedImage img = new BufferedImage(70, 35, BufferedImage.TYPE_INT_RGB);
        Graphics2D graphics2D = (Graphics2D) img.getGraphics();
        graphics2D.setColor(Color.WHITE);
        //填充矩形
        graphics2D.fillRect(0, 0, 70, 35);
        graphics2D.setColor(Color.RED);
        graphics2D.drawString("Hello", 2, 35 - 2);

       String imgPath = "/users/koizumisinya/desktop/workspace/javaspace/myjavawebproject/Demo1/res/test.jpg";
        try {
            ImageIO.write(img,"jpeg",new FileOutputStream(imgPath));
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}
